﻿<Window x:Class="EpubEditor.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           FontSize="16" 
        FontFamily="Georgia"
        Height="659"
        Width="920"
        Title="Epub Editor"
        DataContext="{Binding Main, Source={StaticResource Locator}}">
    
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Skins/MainSkin.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <DockPanel>
        <DockPanel DockPanel.Dock="Top" KeyboardNavigation.TabNavigation="None">
            <Menu KeyboardNavigation.TabNavigation="Cycle">
                <MenuItem Header="_File">
                    <MenuItem Header="_Browse for Folder" Command="{Binding BrowseCommand}" />
                    <MenuItem Header="_Save" Command="{Binding SaveZipCommand}"/>
                </MenuItem>
                <MenuItem Header="_View">
                    <MenuItem Header="View _File" Command="{Binding Path=ViewFileCommand}" />
                </MenuItem>
                <MenuItem Header="_Help" />
            </Menu>
        </DockPanel>
        <ToolBar DockPanel.Dock="Top" >
            <Button Command="{Binding BrowseCommand}" ToolTip="Browse for epub folder">Browse</Button>
            <Button Command="{Binding Path=ViewFileCommand}" ToolTip="View file in your reader" Content="View"/>
            <Button Command="{Binding SaveZipCommand}" Content="Save" ToolTip="Save your changes"/>
        </ToolBar>


        <Grid x:Name="LayoutRoot">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="3*" MinWidth="120"  />
                <ColumnDefinition Width="Auto" MinWidth="5"/>
                <ColumnDefinition Width="5*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="1*"/>
                <RowDefinition Height="1*"/>
            </Grid.RowDefinitions>
            
            <Grid.Resources>
                <Style x:Key="tbName" TargetType="{x:Type TextBlock}">
                    <Setter Property="Foreground" Value="White"/>
                    <Setter Property="Background" Value="CornflowerBlue"/>
                </Style>
            </Grid.Resources>
            
            <GridSplitter Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"
HorizontalAlignment="Center" Background="Bisque"
VerticalAlignment="Stretch" Width="8" BorderThickness="2" />
            <DockPanel Grid.Column="0" Grid.Row="0" Margin="2">
                <TextBlock Style="{StaticResource tbName}" DockPanel.Dock="Top" 
                           Text="{Binding Folder}"  Margin="2" Padding="2"/>
                <ScrollViewer >
                    <ListBox  HorizontalAlignment="Stretch" Margin="4,4,4,4" Padding="3"
Name="listBox1" VerticalAlignment="Stretch" MouseDoubleClick="listBox1_MouseDoubleClick"
ItemsSource="{Binding Files}" SelectedItem="{Binding SelectedFile}" DisplayMemberPath="Name"
                      />
                </ScrollViewer>
            </DockPanel>
            
            <DockPanel Grid.Column="0" Grid.Row="1" Margin="2">
                <TextBlock DockPanel.Dock="Top" Margin="10 2 2 2" Padding="2" 
                           ToolTip="{Binding Path=SelectedFile.Name}"                           
                           Text="{Binding Path=SelectedFile.Name}" Style="{StaticResource tbName}" />
                <ScrollViewer >
                    <ListBox  ItemsSource="{Binding ZipFileNames}" Margin="4" Padding="3"
                              HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
SelectedItem="{Binding SelectedZipFileName}" />
                </ScrollViewer>
            </DockPanel>

            <DockPanel Grid.Column="2" Grid.Row="0" Grid.RowSpan="2">

                <TextBlock Margin="5,4,2,2" DockPanel.Dock="Top" Text="{Binding SelectedZipFileName}"
                           Style="{StaticResource tbName}" Padding="2"/>
                <ScrollViewer ScrollViewer.HorizontalScrollBarVisibility="Auto">
                   
                    <TextBox Height="Auto"
                    Margin="5,4,2,2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
                    Text="{Binding Content, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />                     
                
                </ScrollViewer>
            </DockPanel>

        </Grid>
    </DockPanel>
</Window>
